Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers/enc28j60: disable flow control #19845

Merged
merged 1 commit into from
Jul 24, 2023
Merged

Conversation

LP-HAW
Copy link
Contributor

@LP-HAW LP-HAW commented Jul 23, 2023

Contribution description

This PR disables flow control in the ENC28J60 driver init function.

Setting FCEN1 in the EFLOCON register causes the ENC28J60 to periodically send pause frames. It should only be set when the receiver is running out of buffer space [1].

(Also, the FULDPXS bit in EFLOCON is read-only.)

[1] https://ww1.microchip.com/downloads/en/devicedoc/39662c.pdf

Testing procedure

Launch Wireshark / tshark on an interface connected to an ENC28J60 controlled by RIOT. Without this PR you should see a pause frame being sent about every 100 ms (~10x per second):

1 0.000000000 b2:db:01:ec:f7:be → MAC-specific-ctrl-proto-01 MAC CTRL 60 Pause: pause_time: 4096 quanta
2 0.104906555 b2:db:01:ec:f7:be → MAC-specific-ctrl-proto-01 MAC CTRL 60 Pause: pause_time: 4096 quanta
3 0.209834541 b2:db:01:ec:f7:be → MAC-specific-ctrl-proto-01 MAC CTRL 60 Pause: pause_time: 4096 quanta
4 0.314747209 b2:db:01:ec:f7:be → MAC-specific-ctrl-proto-01 MAC CTRL 60 Pause: pause_time: 4096 quanta
5 0.419674312 b2:db:01:ec:f7:be → MAC-specific-ctrl-proto-01 MAC CTRL 60 Pause: pause_time: 4096 quanta
...

With this PR no pause frames are sent.

Issues/PRs references

None

@LP-HAW LP-HAW requested a review from haukepetersen as a code owner July 23, 2023 06:07
@github-actions github-actions bot added the Area: drivers Area: Device drivers label Jul 23, 2023
@benpicco benpicco requested a review from maribu July 24, 2023 10:34
@benpicco benpicco added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jul 24, 2023
@maribu
Copy link
Member

maribu commented Jul 24, 2023

I can confirm this, setting the bit indeed blindly sends pause frames periodically:

image

It appears that the author of the driver assumed that flow control would only send pause frames when the RX buffer of the ENC28J60 would run out of space. To add proper flow control to the driver, we would have to enable and disable sending pause frames depending on the network load.

I agree that having no flow control is much better than having broken flow control.

@riot-ci
Copy link

riot-ci commented Jul 24, 2023

Murdock results

✔️ PASSED

61857d1 drivers/enc28j60: disable flow control

Success Failures Total Runtime
7906 0 7906 11m:36s

Artifacts

@maribu
Copy link
Member

maribu commented Jul 24, 2023

bors merge

@bors
Copy link
Contributor

bors bot commented Jul 24, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot merged commit da9d137 into RIOT-OS:master Jul 24, 2023
@MrKevinWeiss MrKevinWeiss added this to the Release 2023.10 milestone Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: drivers Area: Device drivers CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants